package com.xiaoc.bulldozer.common.service.impl;

import java.util.List;
import java.util.Date;
import javax.annotation.Resource;

import com.xiaoc.bulldozer.common.dto.FormRecordDto;
import org.springframework.stereotype.Service;
import com.xiaoc.bulldozer.common.dao.FormRecordMapper;
import com.xiaoc.bulldozer.common.dto.FormRecordQueryDto;
import com.xiaoc.bulldozer.common.model.FormRecord;
import com.xiaoc.bulldozer.common.service.FormRecordService;

/**
 * FormRecord Service 实现类
 *
 * @author Danfo Yam
 * @date 2018-11-29 17:17:01
 */
@Service("formRecordService")
public class FormRecordServiceImpl implements FormRecordService {

    @Resource
    private FormRecordMapper formRecordMapper;

    @Override
    public Integer getFormRecordCountByCondition(FormRecordQueryDto formRecordQueryDto) {
        return formRecordMapper.getFormRecordCountByCondition(formRecordQueryDto);
    }

    @Override
    public List<FormRecord> getFormRecordListByCondition(FormRecordQueryDto formRecordQueryDto) {
        return formRecordMapper.getFormRecordListByCondition(formRecordQueryDto);
    }

    @Override
    public FormRecord getFormRecordById(Integer id) {
        return formRecordMapper.getFormRecordById(id);
    }

    @Override
    public List<FormRecord> getAllFormRecordList() {
        return formRecordMapper.getAllFormRecordList();
    }

    @Override
    public void save(FormRecord formRecord) {
        formRecordMapper.save(formRecord);
    }

    @Override
    public void update(FormRecord formRecord) {
        formRecordMapper.update(formRecord);
    }

    @Override
    public void deleteById(Integer id) {
        formRecordMapper.deleteById(id);
    }

    @Override
    public List<FormRecordDto> getFormRecordListByFormIdAndType(Integer formId, Integer type) {
        return formRecordMapper.getFormRecordListByFormIdAndType(formId, type);
    }

    @Override
    public List<FormRecordDto> getLoanCountListByDateAndFormIdListAndTypeAndProcessStatusListAndProcessPersonId(String date, List<Integer> formIdList, Integer type, List<Integer> processStatusList, Integer processPersonId) {
        return formRecordMapper.getLoanCountListByDateAndFormIdListAndTypeAndProcessStatusListAndProcessPersonId(date, formIdList, type, processStatusList, processPersonId);
    }

    @Override
    public List<FormRecord> getLoanRecordByDateAndProcessPersonIdAndType(String date, Integer processPersonId, Integer type) {
        return formRecordMapper.getLoanRecordByDateAndProcessPersonIdAndType(date, processPersonId, type);
    }

    @Override
    public List<FormRecord> getRecentFormRecordByTypeAndStatusListAndFormIdList(Integer type, List<Integer> processStatusList, List<Integer> formIdList) {
        return formRecordMapper.getRecentFormRecordByTypeAndStatusListAndFormIdList(type, processStatusList, formIdList);
    }


    @Override
    public Integer getCountByStatusAndProcessPersonIdAndType(Integer processStatus, Integer processPersonId, Integer type) {
        return formRecordMapper.getCountByStatusAndProcessPersonIdAndType(processStatus, processPersonId, type);
    }

    @Override
    public List<FormRecord> getListByStatusAndProcessPersonIdAndType(FormRecordQueryDto formRecordQueryDto) {
        return formRecordMapper.getListByStatusAndProcessPersonIdAndType(formRecordQueryDto);
    }

    /**
     * 根据条件获取去重的count
     *
     * @param formRecordQueryDto
     * @return
     */
    @Override
    public Integer getDistinctFormRecordCountByTypeAndAccountIdAndPhoneNumber(FormRecordQueryDto formRecordQueryDto) {
        return formRecordMapper.getDistinctFormRecordCountByTypeAndAccountIdAndPhoneNumber(formRecordQueryDto);
    }

    @Override
    public List<FormRecordDto> getDistinctFormRecordDtoListByAccountIdAndStatusAndType(FormRecordQueryDto formRecordQueryDto) {
        return formRecordMapper.getDistinctFormRecordDtoListByAccountIdAndStatusAndType(formRecordQueryDto);
    }


    @Override
    public List<FormRecord> getFormRecordListByFormIdListAndType(List<Integer> formIdList, Integer type) {
        return formRecordMapper.getFormRecordListByFormIdListAndType(formIdList, type);
    }
}
